home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / hotjava / classsrc / browser / litagr~1.jav < prev    next >
Encoding:
Text File  |  1995-08-11  |  1.8 KB  |  68 lines

  1. /*
  2.  * @(#)LITagRef.java    1.8 95/03/14 Jonathan Payne
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package browser;
  21.  
  22. import java.util.*;
  23. import java.io.*;
  24. import awt.*;
  25. import net.*;
  26. import net.www.http.*;
  27. import net.www.html.*;
  28.  
  29. /**
  30.  * Class LITagRef is created for <li> tags that appear in html
  31.  * document.
  32.  * @version 1.8, 14 Mar 1995
  33.  * @author Jonathan Payne
  34.  */
  35.  
  36. public class LITagRef extends DisplayItemTagRef {
  37.     public LITagRef(Tag t, int pos, boolean isEnd) {
  38.     super(t, pos, isEnd);
  39.     }
  40.  
  41.     /**
  42.      * Builds the DisplayItem for this tag by asking the the list
  43.      * context associated with the WRFormatter to create the next
  44.      * tag.
  45.      */
  46.     public void buildDisplayItem(WRFormatter f) {
  47.     WRListRef    r = f.listContext();
  48.  
  49.     if (r != null) {
  50.         di = r.getNextBullet(f);
  51.     }
  52.     }
  53.  
  54.     public void apply(WRFormatter f) {
  55.     WRListRef    ref = f.listContext();
  56.     int newMargin;
  57.  
  58.     f.breakLine(0);
  59.     if (ref != null && !(ref instanceof DLTagRef)) {
  60.         f.setLeftMargin(ref.margin);
  61.         super.apply(f);    
  62.         newMargin = f.getXCoordinate() + 8;
  63.         f.setXCoordinate(newMargin);
  64.         f.setLeftMargin(newMargin);
  65.     }
  66.     }
  67. }
  68.